﻿using Microsoft.AspNetCore.Mvc;
using Zhp.Api.Attributes;
using Zhp.Workflow.Services;

namespace Zhp.Api.Controllers.Home
{

    [Route("api/[controller]/[action]")]
    [ApiController]
    [SeedMenu(MenuGroup = ApiGroupEnum.None, Name = "首页", Order = 1, RouterName = "home", WebFilePath = "home/index", Icon = "homepage")]
    public class HomeController : ControllerBase
    {
        private readonly IWorkflowService _workflowService;
        public HomeController(IWorkflowService workflowService)
        {
            _workflowService = workflowService;
        }

        /// <summary>
        /// 待审批
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [SeedList("待审批", "首页", ApiGroupEnum.None)]
        public async Task<int> PendingApproveCount()
        {
            return await _workflowService.PendingApproveCount();
        }

        /// <summary>
        /// 已审批
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [SeedList("已审批", "首页", ApiGroupEnum.None)]
        public async Task<int> ApprovedCount()
        {
            return await _workflowService.ApprovedCount();
        }
    }
}
